<?php

namespace App\Models;


/**
 * App\Models\Region
 *
 * @property int $id
 * @property int $code 地区代码
 * @property int $p_code 上级地区代码
 * @property string $name 区域名称
 * @method static \Illuminate\Database\Eloquent\Builder|Region newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Region newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Region query()
 * @method static \Illuminate\Database\Eloquent\Builder|Region whereCode($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Region whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Region whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Region wherePCode($value)
 * @mixin \Eloquent
 */
class Region extends Base
{
    protected $table = 'region';
    public $timestamps = false;

    // 省列表
    static function getListProvince()
    {
        return self::wherePCode(0)->get();
    }

    // 市列表
    static function getListCity($province_id)
    {
        return self::wherePCode($province_id)->get();
    }

    // 区列表
    static function getListArea($city_id)
    {
        return self::wherePCode($city_id)->get();
    }
}
